/**
 * Created by mengxiaxia on 2017/1/15.
 */
(function () {
    var app=angular.module("routingDemoApp",['ngRoute']);

    app.config([
        '$logProvider','$routeProvider','$locationProvider',function (log,route,location) {
            log.debugEnabled(true);
            location.hashPrefix('zhtt');/** 自定义路由模式 **/
            /** 使用HTML5格式 **/
            /** $locationProvider.html5Mode({
                enabled: true,
                requireBase: true, //需要配置基地址
                rewriteLinks: true //遇到旧版本的浏览器会使用默认的Hashbang模式
            });**/
            route
                .when('/',{
                controller:'HomeController',
                controllerAs:'home',
                template:'<H1>{{message}}</H1>'
            })
                .when('/schools',{
                    controller:'AllSchoolsController',
                    controllerAs:'schools',
                    template:'<H1>{{message}}</H1>',
                    caseInsensitiveMatch: true/** 禁止大小写敏感 **/
                })
                .otherwise('/');/** 系统默认页 **/
        }
    ]);

    app.controller('HomeController',[ '$scope','$interval','$route','$window', HomeController]);
    app.controller('AllSchoolsController',function ($scope) {
       $scope.message='AllSchoolsController！';
    });

    function HomeController($scope,$interval,$route,$window) {
        $scope.message='HomeController！';
    }
})();